<template>
    <div>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>科室名称</td>
                    <td><input type="text" v-model="querInfo.hospName"></td>
                </tr>
                <tr>
                    <td>科室类别</td>
                    <td><input type="text" v-model="querInfo.hospType"></td>
                </tr>
                <tr>
                    <td>使用状态</td>
                    <td><input type="text" v-model="querInfo.hospState"></td>
                </tr>
                <tr>
                    <td>门诊诊室</td>
                    <td><input type="text" v-model="querInfo.hospRoom"></td>
                </tr>
                <tr>
                    <td>住院病区</td>
                    <td><input type="text" v-model="querInfo.hospArea"></td>
                </tr>
                <tr>
                    <td>科室简介</td>
                    <td><input type="text" v-model="querInfo.hospJj"></td>
                </tr>
                <tr>
                    <td>科室电话</td>
                    <td><input type="text" v-model="querInfo.hospTel"></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="button" value="添加" @click="ok"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref,reactive,onMounted } from 'vue';
import axios from 'axios';
import moment from 'moment';
import { useRoute,useRouter } from 'vue-router';
const route=useRoute();
const router=useRouter();

let querInfo:any=reactive({

  "hospName": "",
  "hospType": "",
  "hospState": "",
  "hospRoom": "",
  "hospArea": "",
  "hospJj": "",
  "hospTel": "",
 
})
const ok=()=>{
    axios({
        url:'/api/Hosp/HospAdd',
        method:'post',
        data:querInfo
    })
    .then((res)=>{
        if(res.data==-1)
    {
        alert("名称不能重复");
        return;
    }
   else if(res.data>0)
    {
        alert("添加成功");
        return;
    }
    else
    {
        alert("添加失败")
        return;
    }
    })
}




</script>

<style scoped>

</style>